<h1>Brochure List</h1>
<div id="admin_icon_edit">
<li><?php echo CHtml::link(CHtml::image(Yii::app()->request->baseUrl.'/images/icons/icon_add2.png'). ' Create Brochure', array('brochures/create'));?></li>
</div>
<?php  $this->widget('zii.widgets.grid.CGridView', array(
    'dataProvider'=>$dataProvider,
    'columns'=>array(
      array(
        'header'=>'No.',
        'value'=>'$this->grid->dataProvider->pagination->currentPage * $this->grid->dataProvider->pagination->pageSize + ($row+1)',
      ),
      array(
        'name' => 'Thumbnail',
        'type' => 'raw',
        'value' => 'isset($data->photo_path) ? CHtml::image(Yii::app()->request->baseUrl.$data->thumbnailPath) : ""'
      ),
      'name_en',
      array(
        'header'=>'Enable',
        'class'=>'CButtonColumn',
        'template'=>'{enable} {disable}',
        'buttons'=>array(
          'enable' => array(
            'imageUrl' => Yii::app()->request->baseUrl.'/images/icons/icon_enable.jpg',
            'visible'=>'$data->enable == true',
            'url'=>'Yii::app()->createUrl("promotion/updateStatus", array("id"=>$data->id))',
            'click'=>'function(){if (confirm("Do you want to disable this data?")){return true; }else { return false;}}',
          ),
          'disable' => array(
            'imageUrl' => Yii::app()->request->baseUrl.'/images/icons/icon_disable.jpg',
            'visible'=>'$data->enable == false',
            'url'=>'Yii::app()->createUrl("promotion/updateStatus", array("id"=>$data->id))',
            'click'=>'function(){if (confirm("Do you want to enable this data?")){return true; }else { return false;}}',
          )
        ),
      ),
      array(
        'header'=>'Edit',
        'class'=>'CButtonColumn',
        'template'=>'{update}',
        'buttons'=>array(
          'update' => array(
            'imageUrl'=>Yii::app()->request->baseUrl.'/images/icons/icon_edit.jpg',
          )
        ),
      ),
      array(
        'header'=>'Delete',
        'class'=>'CButtonColumn',
        'template'=>'{delete}',
        'buttons'=>array(
          'delete' => array(
            'imageUrl'=>Yii::app()->request->baseUrl.'/images/icons/icon_bin.jpg',
          )
        ),
      ),
    ),
  )); ?>
